/**
 * Licensed to Open-Ones Group under one or more contributor license
 * agreements. See the NOTICE file distributed with this work
 * for additional information regarding copyright ownership.
 * Open-Ones Group licenses this file to you under the Apache License,
 * Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a
 * copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package openones.ipresenter.android.view;

import openones.ipresenter.android.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

/**
 * Represent the Main menu screen.
 * 
 * @author OOG member
 */
public class MainMenuActivity extends Activity {
    /**
     * Called when the activity is first created. The activity is about to
     * become visible.
     * 
     * @param savedInstanceState
     *            Information about the last state.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mainmenu);

        setupUI();
    }

    /**
     * Setup the UI. Set the OnClickListener for the buttons.
     */
    void setupUI() {
        Button btScanBluetooth = (Button) findViewById(R.id.mainmenu_btScanBluetooth);
        if (btScanBluetooth != null) {
            btScanBluetooth.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    Intent intent = new Intent(MainMenuActivity.this,
                            ScanBluetoothActivity.class);
                    startActivity(intent);
                }
            });
        }

        Button btScanWifi = (Button) findViewById(R.id.mainmenu_btScanWifi);
        if (btScanWifi != null) {
            btScanWifi.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    Intent intent = new Intent(MainMenuActivity.this,
                            ScanWifiActivity.class);
                    startActivity(intent);

                }
            });
        }

        Button btQuit = (Button) findViewById(R.id.mainmenu_btQuit);
        if (btQuit != null) {
            btQuit.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    // Intent intent = new Intent(MainMenuActivity.this,
                    // PresentActivity.class);
                    // startActivity(intent);
                    finish();

                }
            });
        }
    }
    
}